class TourplansController < ApplicationController
  # GET /tourplans
  # GET /tourplans.xml
  layout 'main'
  def index
    @tourplans = Tourplan.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @tourplans }
    end
  end

  # GET /tourplans/1
  # GET /tourplans/1.xml
  def show
    @tourplan = Tourplan.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @tourplan }
    end
  end

  # GET /tourplans/new
  # GET /tourplans/new.xml
  def new
    @tourplan = Tourplan.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @tourplan }
    end
  end

  # GET /tourplans/1/edit
  def edit
    @tourplan = Tourplan.find(params[:id])
  end

  # POST /tourplans
  # POST /tourplans.xml
  def create
    @tourplan = Tourplan.new(params[:tourplan])

    respond_to do |format|
      if @tourplan.save
        flash[:notice] = 'Tourplan was successfully created.'
        format.html { redirect_to(@tourplan) }
        format.xml  { render :xml => @tourplan, :status => :created, :location => @tourplan }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @tourplan.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /tourplans/1
  # PUT /tourplans/1.xml
  def update
    @tourplan = Tourplan.find(params[:id])

    respond_to do |format|
      if @tourplan.update_attributes(params[:tourplan])
        flash[:notice] = 'Tourplan was successfully updated.'
        format.html { redirect_to(@tourplan) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @tourplan.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /tourplans/1
  # DELETE /tourplans/1.xml
  def destroy
    @tourplan = Tourplan.find(params[:id])
    @tourplan.destroy

    respond_to do |format|
      format.html { redirect_to(tourplans_url) }
      format.xml  { head :ok }
    end
  end
end
